hysop.backend.device.opencl.opencl_symbolic module

Abstract class providing a common interface to all discrete operators working on the OpenCl backend and using kernels generated on the fly from symbolic expressions.

  • OpenClSymbolic is an abstract class

    used to provide a common interface to all discrete operators working with the opencl backend and using kernels generated on the fly from symbolic expressions.

class hysop.backend.device.opencl.opencl_symbolic.OpenClSymbolic(**kwds)[source]

Bases: OpenClOperator

Abstract class for discrete operators working on OpenCL backends that require custom symbolic kernels.

Create an OpenClOperator with extra symbolic kernels.

All input and output variable topologies should be of kind Backend.OPENCL and share the same OpenClEnvironment.

kwds

Base class keyword arguments.

Type:

dict

classmethod available_methods()[source]

Returns the available methods of this node. This should return a dictionary of method as keys and possible values as a scalar or an iterable. See hysop.types.InstanceOf to support specific class types. This is used to check user method input.

classmethod default_method()[source]

Returns the default method of this node. Default methods should be compatible with available_methods. If the user provided method dictionnaty misses some method keys, a default value for this key will be extracted from the default one.

discretize(force_symbolic_axes=None)[source]

Discretize symbolic expressions.

get_field_requirements()[source]

Extract field requirements from first expression parsing stage.

handle_method(method)[source]

Extract methods for symbolic kernels.

initialize(**kwds)[source]

Initialize this node.

Initialization step sets the following variables:

*self.method, *self.input_field_requirements *self.output_field_requirements *self.initialized

It returns self.method.

Order of execution is:

self.pre_initialize() self._setup_method() self.handle_method() self.get_field_requirements() self._initialized = True self.post_initialize()

See ComputationalGraphNode.handle_method() to see how user method is handled. See ComputationalGraphNode.get_field_requirements() to see how topology requirements are handled.

After this method has been handled by all operators, initialization collects min and max ghosts required by each operators which will be usefull in the discretiezation step to automatically build topologies or check against user supplied topologies.

This function also sets the self.initialized flag to True (just before post initialization). Once this flag is set one may call ComputationalGraphNode.discretize().

require_symbolic_kernel(name, *exprs, **extra_kwds)[source]
setup(work)[source]

Setup temporary buffer that have been requested in get_work_properties(). This function may be used to execute post allocation routines. This sets self.ready flag to True. Once this flag is set one may call ComputationalGraphNode.apply() and ComputationalGraphNode.finalize().

Automatically honour temporary field memory requests.

classmethod symbolic_arrays(*names, **kwds)[source]
classmethod symbolic_buffers(*names, **kwds)[source]
classmethod symbolic_constants(*names, **kwds)[source]
classmethod symbolic_ndbuffers(*names, **kwds)[source]
classmethod symbolic_tmp_scalars(*names, **kwds)[source]